<template>
	<view class="wrap">
		<u-navbar :title="$t('dlsktjl')" title-width="340" :border-bottom="false" back-icon-color="#fff" title-color="#fff" :background="{ backgroundColor: '#0030A8' }"></u-navbar>
		<view class="tom-container">
			<view class="list">
				<mescroll-uni  :fixed="false" ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback">
					<view class="list_nr_li" v-for="(item,index) in list" :key="index">
						<view class="left">
							<view class="text1">{{item.applyType}}</view>
							<view class="text2">{{item.createDate}}</view>
						</view>
						<view class="right">
							<view class="text1">{{item.applyValue}}</view>
							<view class="text2">{{item.userLevelName}}</view>
						</view>
					</view>
				</mescroll-uni>
			</view>
		</view>
	</view>
</template>

<script>
import MescrollMixin from "@/components/mescroll-uni/mescroll-mixins.js";
export default {
	mixins: [MescrollMixin],
	data() {
		return {
			list:[]
		};
	},
	methods: {
		// 下拉刷新
		downCallback(){
			this.mescroll.resetUpScroll()
		},
		// 上拉加载
		upCallback(page){
			uni.showLoading({
				mask: true,
				title: this.$t('loading.title')
			});
			this.$api.userApi
				.getOpenLevelRecord()
				.then(res => {
					// this.pageData = res.data;
					let list=res.data || [];
					this.mescroll.endSuccess(list.length)
					if(page.num == 1) this.list = []; //如果是第一页需手动制空列表
					this.list=this.list.concat(list); //追加新数据
					uni.hideLoading();
				}).catch(res =>{
					uni.hideLoading();
				})
		},
	}
};
</script>

<style lang="scss" scoped>
.tom-container {
	padding-top: 50rpx;
}
.list {
	background-color: #fff;
	flex: 1;
	display: flex;
	flex-direction: column;
	border-radius: 50rpx 50rpx 0rpx 0rpx;
	.list_nr_li {
		color: $tom-text-color;
		display: flex;
		align-items: center;
		justify-content: space-between;
		padding: 24rpx $nr-padd;
		border-bottom: 2rpx solid $page-bg;
		.left {
			font-weight: bold;
			font-size: 28rpx;
			.text1 {
				margin-bottom: 18rpx;
			}
			.text2 {
				color:$tom-text-red;
			}
		}
		.right {
			text-align: right;
			.text1 {
				font-size: 24rpx;
				margin-bottom: 18rpx;
				color: $tom-text-sub-color2;
			}
			.text2 {
				font-size: 24rpx;
				color: $tom-text-sub-color2;
			}
		}
	}
}
</style>
